Make the string->string map and int->float map allocation functions set the
authorEwan Mellor <ewan@xensource.com>
Thu, 1 Feb 2007 19:00:17 +0000 (19:00 +0000)
committerEwan Mellor <ewan@xensource.com>
Thu, 1 Feb 2007 19:00:17 +0000 (19:00 +0000)
map size on allocation.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
tools/libxen/src/xen_int_float_map.c
tools/libxen/src/xen_string_string_map.c

index edfcb21ac2ba20dd7515ad7f64c6668627b8968d..33ff29de6258bc88ffaaf5765ee1195262162305 100644 (file)
 xen_int_float_map *
 xen_int_float_map_alloc(size_t size)
 {
-    return calloc(1, sizeof(xen_int_float_map) +
-                  size * sizeof(struct xen_int_float_map_contents));
+    xen_int_float_map *result = calloc(1, sizeof(xen_int_float_map) +
+                                       size * sizeof(struct xen_int_float_map_contents));
+    result->size = size;
+    return result;
 }
 
 
index 34f5ec4d706836d882b0483dc324b163daec4b22..b07acfbf7c6067e799db1f5a155474d633df06f1 100644 (file)
 xen_string_string_map *
 xen_string_string_map_alloc(size_t size)
 {
-    return calloc(1, sizeof(xen_string_string_map) +
-                  size * sizeof(struct xen_string_string_map_contents));
+    xen_string_string_map *result = calloc(1, sizeof(xen_string_string_map) +
+                                           size * sizeof(struct xen_string_string_map_contents));
+    result->size = size;
+    return result;
 }